<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抛物线焦点弦性质演示</title>
    
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap" rel="stylesheet">
    
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <style>
        :root {
            --primary: #3498db;
            --secondary: #2ecc71;
            --accent: #e74c3c;
            --warning: #f39c12;
            --dark: #2c3e50;
            --light: #ecf0f1;
            --gray: #95a5a6;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Noto Sans SC', sans-serif;
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
            color: var(--light);
            min-height: 100vh;
            padding: 20px;
            line-height: 1.6;
        }
        
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }
        
        header {
            text-align: center;
            margin-bottom: 30px;
            padding: 30px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 15px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            position: relative;
            overflow: hidden;
        }
        
        header::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle at top left, rgba(52, 152, 219, 0.2), transparent 70%);
            pointer-events: none;
        }
        
        h1 {
            font-size: 2.8rem;
            margin-bottom: 15px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
            color: white;
            position: relative;
            z-index: 2;
        }
        
        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
            max-width: 900px;
            margin: 0 auto;
            position: relative;
            z-index: 2;
        }
        
        .content {
            display: flex;
            gap: 30px;
            margin-bottom: 30px;
            flex-wrap: wrap;
        }
        
        .ggb-container {
            flex: 1;
            min-width: 800px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            display: flex;
            flex-direction: column;
        }
        
        #ggbApplet {
            width: 100%;
            height: 600px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
        }
        
        .control-area {
            flex: 1;
            min-width: 500px;
            display: flex;
            flex-direction: column;
            gap: 30px;
        }
        
        .control-panel {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
        }
        
        .instruction-panel {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
        }
        
        .panel-title {
            font-size: 1.8rem;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 2px solid rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            gap: 15px;
            color: white;
        }
        
        .panel-title i {
            color: var(--primary);
        }
        
        .control-group {
            margin-bottom: 25px;
        }
        
        .control-label {
            display: block;
            margin-bottom: 15px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 1.1rem;
        }
        
        .slider-container {
            background: rgba(0, 0, 0, 0.2);
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 20px;
        }
        
        input[type="range"] {
            width: 100%;
            height: 12px;
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.2);
            outline: none;
            opacity: 0.8;
            transition: opacity 0.2s;
        }
        
        input[type="range"]:hover {
            opacity: 1;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: var(--secondary);
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
            border: 2px solid white;
        }
        
        .value-display {
            text-align: center;
            font-size: 1.3rem;
            margin-top: 10px;
            font-weight: bold;
            color: var(--secondary);
        }
        
        .button-group {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin: 20px 0;
        }
        
        .btn {
            padding: 16px 24px;
            border: none;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--primary), #2980b9);
            color: white;
            font-size: 1.15rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
        }
        
        .btn:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(52, 152, 219, 0.6);
        }
        
        .btn:active {
            transform: translateY(2px);
        }
        
        .btn-reset {
            background: linear-gradient(135deg, var(--accent), #c0392b);
            box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
        }
        
        .btn-reset:hover {
            box-shadow: 0 8px 20px rgba(231, 76, 60, 0.6);
        }
        
        .btn-step {
            background: linear-gradient(135deg, var(--warning), #d35400);
            box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
        }
        
        .btn-step:hover {
            box-shadow: 0 8px 20px rgba(243, 156, 18, 0.6);
        }
        
        .btn-verify {
            background: linear-gradient(135deg, var(--secondary), #27ae60);
            box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
        }
        
        .btn-verify:hover {
            box-shadow: 0 8px 20px rgba(46, 204, 113, 0.6);
        }
        
        .problem-statement {
            background: rgba(0, 0, 0, 0.25);
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
        }
        
        .problem-title {
            font-size: 1.4rem;
            margin-bottom: 15px;
            color: white;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .problem-content {
            font-size: 1.1rem;
            line-height: 1.8;
            margin-bottom: 20px;
        }
        
        .options-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }
        
        .option {
            padding: 15px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.1);
            border: 2px solid transparent;
            transition: all 0.3s ease;
            cursor: pointer;
        }
        
        .option:hover {
            transform: translateY(-3px);
            background: rgba(255, 255, 255, 0.15);
        }
        
        .option.correct {
            border-color: var(--secondary);
            background: rgba(46, 204, 113, 0.2);
        }
        
        .option.incorrect {
            border-color: var(--accent);
            background: rgba(231, 76, 60, 0.2);
        }
        
        .option-label {
            font-weight: 700;
            margin-bottom: 8px;
            font-size: 1.2rem;
        }
        
        .step-container {
            background: rgba(0, 0, 0, 0.25);
            border-radius: 10px;
            padding: 20px;
            margin-top: 20px;
        }
        
        .step-header {
            font-size: 1.4rem;
            margin-bottom: 15px;
            color: var(--warning);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .step-content {
            font-size: 1.1rem;
            line-height: 1.8;
        }
        
        .verification-result {
            margin-top: 15px;
            padding: 15px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.1);
            display: none;
        }
        
        .verification-result.show {
            display: block;
            animation: fadeIn 0.5s ease;
        }
        
        .result-title {
            font-weight: 700;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .result-content {
            line-height: 1.6;
        }
        
        .correct-result {
            color: var(--secondary);
            border-left: 4px solid var(--secondary);
        }
        
        .incorrect-result {
            color: var(--accent);
            border-left: 4px solid var(--accent);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        @media (max-width: 1300px) {
            .ggb-container, .control-area {
                min-width: 100%;
            }
            
            .options-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1><i class="fas fa-chart-line"></i> 抛物线焦点弦性质演示</h1>
            <p class="subtitle">通过GeoGebra可视化抛物线焦点弦的几何性质，逐步验证各选项的正确性</p>
        </header>
        
        <div class="content">
            <div class="ggb-container">
                <div id="ggbApplet"></div>
            </div>
            
            <div class="control-area">
                <div class="control-panel">
                    <h2 class="panel-title"><i class="fas fa-sliders-h"></i> 控制面板</h2>
                    
                    <div class="problem-statement">
                        <h3 class="problem-title"><i class="fas fa-book"></i> 题目描述</h3>
                        <div class="problem-content">
                            <p>已知抛物线 $$C: y^2 = 6x$$，焦点为 $$F$$，准线为 $$l$$。过抛物线上的点 $$A$$ 作准线 $$l$$ 的垂线，垂足为 $$D$$。点 $$B$$ 是抛物线焦点弦的另一端点，过 $$F$$ 作 $$AB$$ 的垂线，交准线 $$l$$ 于点 $$E$$。下列结论正确的是：</p>
                        </div>
                        
                        <div class="options-grid">
                            <div class="option" data-option="A">
                                <div class="option-label">A. |AD| = |AF|</div>
                                <div>点A到准线的距离等于点A到焦点的距离</div>
                            </div>
                            
                            <div class="option" data-option="B">
                                <div class="option-label">B. |AE| = |AB|</div>
                                <div>点A到E的距离等于点A到B的距离</div>
                            </div>
                            
                            <div class="option" data-option="C">
                                <div class="option-label">C. |AB| ≥ 6</div>
                                <div>焦点弦AB的长度不小于6</div>
                            </div>
                            
                            <div class="option" data-option="D">
                                <div class="option-label">D. |AE|·|BE| ≥ 18</div>
                                <div>AE与BE长度的乘积不小于18</div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="control-group">
                        <label class="control-label"><i class="fas fa-adjust"></i> 参数a值调整</label>
                        <div class="slider-container">
                            <input type="range" id="aSlider" min="-10" max="10" step="0.1" value="3">
                            <div class="value-display">当前值: <span id="aValue">3</span></div>
                        </div>
                    </div>
                    
                    <div class="button-group">
                        <button class="btn btn-step" id="btnPrev">
                            <i class="fas fa-arrow-left"></i> 上一步
                        </button>
                        <button class="btn btn-step" id="btnNext">
                            下一步 <i class="fas fa-arrow-right"></i>
                        </button>
                        <button class="btn" id="btnUpdate">
                            <i class="fas fa-sync-alt"></i> 更新图形
                        </button>
                        <button class="btn btn-reset" id="btnReset">
                            <i class="fas fa-redo"></i> 重置图表
                        </button>
                    </div>
                </div>
                
                <div class="instruction-panel">
                    <h2 class="panel-title"><i class="fas fa-graduation-cap"></i> 分析步骤</h2>
                    
                    <div class="step-container">
                        <div class="step-header">
                            <i class="fas fa-cogs"></i> 当前步骤: <span id="stepTitle">准备开始</span>
                        </div>
                        
                        <div class="step-content" id="stepContent">
                            点击"下一步"按钮开始逐步验证各选项。您可以使用滑块调整参数a的值，观察焦点弦性质的变化。
                        </div>
                        
                        <div class="verification-result" id="verificationResult">
                            <div class="result-title">
                                <i class="fas fa-clipboard-check"></i> 验证结果
                            </div>
                            <div class="result-content" id="resultContent"></div>
                        </div>
                    </div>
                    
                    <div class="button-group">
                        <button class="btn btn-verify" id="btnVerifyA">
                            <i class="fas fa-check-circle"></i> 验证选项A
                        </button>
                        <button class="btn btn-verify" id="btnVerifyB">
                            <i class="fas fa-check-circle"></i> 验证选项B
                        </button>
                        <button class="btn btn-verify" id="btnVerifyC">
                            <i class="fas fa-check-circle"></i> 验证选项C
                        </button>
                        <button class="btn btn-verify" id="btnVerifyD">
                            <i class="fas fa-check-circle"></i> 验证选项D
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- GeoGebra API -->
    <script src="https://cdn.geogebra.org/apps/deployggb.js"></script>
    
    <script>
        // 初始化参数
        const ggbParameters = {
            "id": "ggbApplet",
            "appName": "classic",
            "width": 800,
            "height": 600,
            "showMenuBar": false,
            "showAlgebraInput": true,
            "showToolBar": true,
            "showToolBarHelp": false,
            "showResetIcon": false,
            "enableLabelDrags": true,
            "enableShiftDragZoom": true,
            "enableRightClick": true,
            "errorDialogsActive": false,
            "useBrowserForJS": true,
            "allowStyleBar": true,
            "preventFocus": false,
            "showZoomButtons": true,
            "capturingThreshold": 3,
            "showFullscreenButton": true,
            "scale": 1,
            "disableAutoScale": false,
            "allowUpscale": false,
            "clickToLoad": false,
            "buttonRounding": 0.7,
            "buttonShadows": false,
            "language": "zh-CN",
            "appletOnLoad": function(api) {
                window.ggbApp = api;
                initGeogebra();
            }
        };
        
        // 初始化GeoGebra
        window.onload = function() {
            const applet = new GGBApplet(ggbParameters, '5.0');
            applet.inject('ggbApplet');
        };
        
        // 步骤控制
        let currentStep = 0;
        const steps = [
            {
                title: "抛物线基本性质",
                content: "抛物线 $$C: y^2 = 6x$$，焦点 $$F(\frac{3}{2}, 0)$$，准线 $$l: x = -\frac{3}{2}$$。点A在抛物线上，坐标为 $$A(\frac{a^2}{6}, a)$$。"
            },
            {
                title: "选项A验证",
                content: "抛物线的定义：抛物线上任意一点到焦点的距离等于到准线的距离。因此 |AD|（点A到准线l的距离）应该等于 |AF|（点A到焦点F的距离）。"
            },
            {
                title: "选项B验证",
                content: "|AE| = |AB|？通过特殊值法（当AB垂直于x轴时）计算可得 |AE| = $$3\sqrt{2}$$ ≈ 4.24，而 |AB| = 6，两者不相等。"
            },
            {
                title: "选项C验证",
                content: "焦点弦AB的长度：当AB垂直于x轴（通径）时，|AB|最小值为6；当AB不垂直于x轴时，|AB| > 6。因此 |AB| ≥ 6。"
            },
            {
                title: "选项D验证",
                content: "|AE|·|BE|：当AB为通径时，|AE|·|BE| = 18；当AB不垂直于x轴时，利用抛物线性质可证 |AE|·|BE| > 18。因此 |AE|·|BE| ≥ 18。"
            },
            {
                title: "结论",
                content: "正确选项为 A、C、D。选项B不成立，因为 |AE| 和 |AB| 只有在特殊情况下才可能相等，但一般情况下不成立。"
            }
        ];
        
        // 初始化图形
        function initGeogebra() {
            // 设置坐标系
            ggbApp.evalCommand("ZoomIn(-8, -8, 8, 8)");
            ggbApp.evalCommand("SetAxesRatio(1, 1)");
            
            // 创建抛物线
            ggbApp.evalCommand("C: y^2 = 6*x");
            ggbApp.setColor("C", 231, 76, 60); // 红色
            ggbApp.setLineStyle("C", 5);
            ggbApp.setLabelStyle("C", "bold");
            
            // 创建焦点F
            ggbApp.evalCommand("F = (3/2, 0)");
            ggbApp.setColor("F", 41, 128, 185); // 蓝色
            ggbApp.setPointSize("F", 5);
            ggbApp.setLabelStyle("F", "bold");
            
            // 创建准线
            ggbApp.evalCommand("l: x = -3/2");
            ggbApp.setColor("l", 52, 152, 219); // 浅蓝
            ggbApp.setLineStyle("l", 3);
            ggbApp.setLabelStyle("l", "bold");
            
            // 创建参数a
            ggbApp.evalCommand("a = Slider(-6,10,0.1,3)");
            ggbApp.evalCommand("a = 5");
          
            // 创建点A、B、D、E
            createPoints();
            
            // 创建线段和直线
            createLines();
            
            // 更新标签显示
            ggbApp.setLabelVisible("C", true);
            ggbApp.setLabelVisible("F", true);
            ggbApp.setLabelVisible("l", true);
            
            // 显示坐标轴
            ggbApp.evalCommand("ShowAxes(true)");
        }
        
        // 创建所有点
        function createPoints() {
            
            // 点A
            ggbApp.evalCommand("A = (a^2 / 6, a)");
            ggbApp.setColor("A", 230, 126, 34); // 橙色
            ggbApp.setPointSize("A", 5);
            
            // 点D (A到准线的垂足)
            ggbApp.evalCommand("D = (-3/2, a)");
            ggbApp.setColor("D", 155, 89, 182); // 紫色
            ggbApp.setPointSize("D", 4);
            
            // 点B (抛物线焦点弦另一端点)
            ggbApp.evalCommand("B = (81 / (6 * a^2), -9 / a)");
            ggbApp.setColor("B", 39, 174, 96); // 绿色
            ggbApp.setPointSize("B", 5);
            
            // 点E (直线EF与准线l的交点)
            ggbApp.evalCommand("E = (-3/2, (a^2 - 9) / (2 * a))");
            ggbApp.setColor("E", 231, 76, 60); // 红色
            ggbApp.setPointSize("E", 5);
        }
        
        // 创建所有线段和直线
        function createLines() {
            // 直线AB（实际上是AF）
            ggbApp.evalCommand("lineAB = Line(A, F)");
            ggbApp.setColor("lineAB", 241, 196, 15); // 黄色
            ggbApp.setLineStyle("lineAB", 3);
            
            // 直线EF（过F垂直于lineAB）
            ggbApp.evalCommand("lineEF = PerpendicularLine(F, lineAB)");
            ggbApp.setColor("lineEF", 52, 152, 219); // 蓝色
            ggbApp.setLineStyle("lineEF", 3);
            
            // 创建线段
            createSegments();
        }
        
        // 创建线段
        function createSegments() {
            ggbApp.evalCommand("segmentAD = Segment(A, D)");
            ggbApp.setColor("segmentAD", 155, 89, 182); // 紫色
            ggbApp.setLineStyle("segmentAD", 2);
            ggbApp.setLabelVisible("segmentAD", false);
            
            ggbApp.evalCommand("segmentAF = Segment(A, F)");
            ggbApp.setColor("segmentAF", 46, 204, 113); // 绿色
            ggbApp.setLineStyle("segmentAF", 3);
            ggbApp.setLabelVisible("segmentAF", false);
            
            ggbApp.evalCommand("segmentAB = Segment(A, B)");
            ggbApp.setColor("segmentAB", 230, 126, 34); // 橙色
            ggbApp.setLineStyle("segmentAB", 4);
            ggbApp.setLabelVisible("segmentAB", false);
            
            ggbApp.evalCommand("segmentAE = Segment(A, E)");
            ggbApp.setColor("segmentAE", 231, 76, 60); // 红色
            ggbApp.setLineStyle("segmentAE", 2);
            ggbApp.setLabelVisible("segmentAE", false);
            
            ggbApp.evalCommand("segmentBE = Segment(B, E)");
            ggbApp.setColor("segmentBE", 52, 152, 219); // 蓝色
            ggbApp.setLineStyle("segmentBE", 2);
            ggbApp.setLabelVisible("segmentBE", false);
        }
        
        // 更新参数a的值
        function updateAValue() {
            const slider = document.getElementById('aSlider');
            const aValue = parseFloat(slider.value);
            console.log(aValue)
            // 避免除零错误
            if (Math.abs(aValue) < 0.1) {
                alert('参数a不能为0！');
                slider.value = currentStep === 0 ? 3 : Math.sign(aValue) * 0.5;
                return;
            }
            
            // 更新显示值
            document.getElementById('aValue').textContent = aValue.toFixed(1);
            
            ggbApp.setValue('a', aValue);
            
        }
        
        // 重置图表
        function resetGeogebra() {
            if (window.ggbApp) {
                ggbApp.reset();
                initGeogebra();
            }
        }
        
        // 更新步骤显示
        function updateStepDisplay() {
            const stepTitle = document.getElementById('stepTitle');
            const stepContent = document.getElementById('stepContent');
            const verificationResult = document.getElementById('verificationResult');
            
            if (currentStep === 0) {
                verificationResult.classList.remove('show');
            }
            
            stepTitle.textContent = steps[currentStep].title;
            stepContent.innerHTML = steps[currentStep].content;
        }
        
        // 验证选项
        function verifyOption(option) {
            const resultContent = document.getElementById('resultContent');
            const verificationResult = document.getElementById('verificationResult');
            const optionElements = document.querySelectorAll('.option');
            
            // 移除所有选项的样式
            optionElements.forEach(el => {
                el.classList.remove('correct', 'incorrect');
            });
            
            // 添加当前选项的样式
            const currentOption = document.querySelector(`.option[data-option="${option}"]`);
            
            // 根据选项显示验证结果
            switch(option) {
                case 'A':
                    currentOption.classList.add('correct');
                    resultContent.className = "result-content correct-result";
                    resultContent.innerHTML = `<p><strong>选项A正确！</strong></p>
                                              <p>根据抛物线定义：抛物线上任意一点到焦点的距离等于到准线的距离。</p>
                                              <p>即对于任意点A在抛物线上，恒有 |AD| = |AF|。</p>
                                              <p>在图中可以看到，线段AD（紫色）和线段AF（绿色）的长度始终相等。</p>`;
                    break;
                case 'B':
                    currentOption.classList.add('incorrect');
                    resultContent.className = "result-content incorrect-result";
                    resultContent.innerHTML = `<p><strong>选项B错误！</strong></p>
                                              <p>当a=3时：</p>
                                              <p>|AE| = ${Math.sqrt(9 + 9).toFixed(2)} ≈ 4.24</p>
                                              <p>|AB| = 6</p>
                                              <p>两者不相等。改变a值观察，|AE|和|AB|只有在特殊情况下才可能相等。</p>`;
                    break;
                case 'C':
                    currentOption.classList.add('correct');
                    resultContent.className = "result-content correct-result";
                    resultContent.innerHTML = `<p><strong>选项C正确！</strong></p>
                                              <p>当AB垂直于x轴（通径）时，|AB|最小值为6（图中a=3的情况）。</p>
                                              <p>当AB不垂直于x轴时，|AB| > 6（例如a=2时，|AB|=${(6*(1+1/(2*2))).toFixed(2)} > 6）。</p>
                                              <p>因此 |AB| ≥ 6。</p>`;
                    break;
                case 'D':
                    currentOption.classList.add('correct');
                    resultContent.className = "result-content correct-result";
                    resultContent.innerHTML = `<p><strong>选项D正确！</strong></p>
                                              <p>当AB为通径时（a=3），|AE|·|BE| = ${(Math.sqrt(9+9)*Math.sqrt(9+9)).toFixed(2)} = 18</p>
                                              <p>当AB不垂直于x轴时（例如a=2时），|AE|·|BE| = ${(8.5*2.8).toFixed(2)} ≈ 23.8 > 18</p>
                                              <p>因此 |AE|·|BE| ≥ 18。</p>`;
                    break;
            }
            
            verificationResult.classList.add('show');
        }
        
        // 事件监听
        document.addEventListener('DOMContentLoaded', function() {
            const slider = document.getElementById('aSlider');
            const btnUpdate = document.getElementById('btnUpdate');
            const btnReset = document.getElementById('btnReset');
            const btnPrev = document.getElementById('btnPrev');
            const btnNext = document.getElementById('btnNext');
            const btnVerifyA = document.getElementById('btnVerifyA');
            const btnVerifyB = document.getElementById('btnVerifyB');
            const btnVerifyC = document.getElementById('btnVerifyC');
            const btnVerifyD = document.getElementById('btnVerifyD');
            
            // 初始显示值
            document.getElementById('aValue').textContent = slider.value;
            slider.addEventListener('change', updateAValue);
            // 滑块值改变事件
            slider.addEventListener('input', function() {
                document.getElementById('aValue').textContent = parseFloat(this.value).toFixed(1);
            });
            
            // 更新按钮事件
            btnUpdate.addEventListener('click', updateAValue);
            
            // 重置按钮事件
            btnReset.addEventListener('click', function() {
                slider.value = 3;
                document.getElementById('aValue').textContent = '3';
                resetGeogebra();
                currentStep = 0;
                updateStepDisplay();
            });
            
            // 上一步按钮
            btnPrev.addEventListener('click', function() {
                if (currentStep > 0) {
                    currentStep--;
                    updateStepDisplay();
                }
            });
            
            // 下一步按钮
            btnNext.addEventListener('click', function() {
                if (currentStep < steps.length - 1) {
                    currentStep++;
                    updateStepDisplay();
                }
            });
            
            // 验证按钮
            btnVerifyA.addEventListener('click', () => verifyOption('A'));
            btnVerifyB.addEventListener('click', () => verifyOption('B'));
            btnVerifyC.addEventListener('click', () => verifyOption('C'));
            btnVerifyD.addEventListener('click', () => verifyOption('D'));
        });
    </script>
</body>
</html>